Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[release/2.1] Fix build with clang 10 #28045

Merged
merged 1 commit into from
Jun 11, 2020

Conversation

omajid
Copy link
Member

@omajid omajid commented Jun 2, 2020

This contains a grab bag of fixes to fix the build with clang 10.

  • Fix missing includes in coreclr/src/debug/createdump/ #23075

    Fix missing includes in coreclr/src/debug/createdump/

  • SList::Init: add missing constructor runtime#33096

    SList::Init: add missing constructor

  • A subset of Coreclr gnuport #22129

    Just the parts that introduce the THROW_DECL macro in pal.h

  • Fix re-declarations of builtin functions with clang 10 runtime#32837

    This fixes THROW_DECL introduce in the previous PR to work with clang, which
    is required in clang 10.

  • One new change:

    In a significant divergance, this commits adds more THROW_DECL macros
    to all the math functions to address a ton of errors pointed out when
    building SOS:

     In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116:
     In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19:
     In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16:
     In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36:
     In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45:
     In file included from /usr/include/math.h:290:
     /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration
     __MATHCALL (acos,, (_Mdouble_ __x));
                 ^
     /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here
     PALIMPORT double __cdecl acos(double);
                              ^
    

    Then, to make sure the declarations and implementations match, it adds
    THROW_DECL to the definitions in src/pal/src/cruntime/math.cpp

Co-authored-by: Mike McLaughlin mikem@microsoft.com
Co-authored-by: Sinan Kaya sinan.kaya@microsoft.com
Co-authored-by: Tom Deseyn tom.deseyn@gmail.com

This contains a grab bag of fixes to fix the build with clang 10.

- dotnet#23075

  Fix missing includes in coreclr/src/debug/createdump/

- dotnet/runtime#33096

  SList::Init: add missing constructor

- A subset of dotnet#22129

  Just the parts that introduce the THROW_DECL macro in pal.h

- dotnet/runtime#32837

  This fixes THROW_DECL introduce in the previous PR to work with clang, which
  is required in clang 10.

- One new change:

  In a significant divergance, this commits adds more THROW_DECL macros
  to all the math functions to address a ton of errors pointed out when
  building SOS:

    In file included from /home/omajid/devel/dotnet/coreclr/src/ToolBox/SOS/Strike/strike.cpp:116:
    In file included from /home/omajid/devel/dotnet/coreclr/src/vm/hillclimbing.h:19:
    In file included from /home/omajid/devel/dotnet/coreclr/src/inc/complex.h:16:
    In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/math.h:36:
    In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/cmath:45:
    In file included from /usr/include/math.h:290:
    /usr/include/bits/mathcalls.h:53:13: error: exception specification in declaration does not match previous declaration
    __MATHCALL (acos,, (_Mdouble_ __x));
                ^
    /home/omajid/devel/dotnet/coreclr/src/pal/inc/pal.h:4395:26: note: previous declaration is here
    PALIMPORT double __cdecl acos(double);
                             ^

  Then, to make sure the declarations and implementations match, it adds
  THROW_DECL to the definitions in src/pal/src/cruntime/math.cpp

Co-authored-by: Mike McLaughlin <mikem@microsoft.com>
Co-authored-by: Sinan Kaya <sinan.kaya@microsoft.com>
Co-authored-by: Tom Deseyn <tom.deseyn@gmail.com>
@omajid
Copy link
Member Author

omajid commented Jun 3, 2020

cc @tmds

@omajid
Copy link
Member Author

omajid commented Jun 3, 2020

I have been building coreclr using ./build.sh -skipgenerateversion -ignorewarnings, so this patch shouldn't include fixes for warnings; it only fixes errors pointed out by the compiler.

@omajid
Copy link
Member Author

omajid commented Jun 3, 2020

cc @janvorli @jkotas

This is a backport of #28026

@omajid
Copy link
Member Author

omajid commented Jun 3, 2020

Also, CI looks busted? It checks out the source repository and immediately says testing was successful.

@jkotas
Copy link
Member

jkotas commented Jun 3, 2020

cc @jeffschwMSFT

@jkotas jkotas added the Servicing-consider Issue for next servicing release review label Jun 3, 2020
@jeffschwMSFT
Copy link
Member

@janvorli @tannergooding @jkotas can you review this change?

PALIMPORT double __cdecl sqrt(double);
PALIMPORT double __cdecl tan(double);
PALIMPORT double __cdecl tanh(double);
PALIMPORT double __cdecl acos(double) THROW_DECL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just be aware that throw() is deprecated in C++11 and is removed in C++20

This might also equally break users compiling using a different CRT implementation which is something else to keep in mind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up. I took this code from dotnet/runtime master:

https://github.com/dotnet/runtime/blob/2f563e3a456b2bbf37c53352955cbe380ca584c9/src/coreclr/src/pal/inc/pal.h#L143

Should we start fixing this in runtime?

Copy link
Member

@tannergooding tannergooding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The math bits look fine to me and match what I saw in the GNU LIBC implementation.

@jeffschwMSFT jeffschwMSFT requested a review from janvorli June 3, 2020 21:54
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@janvorli
Copy link
Member

janvorli commented Jun 3, 2020

I am sorry it took me some time to respond. I was thinking about whether instead of modifying these prototypes, we should rather ifdef out the prototypes of functions that are standard C library functions in the pal.h when PAL_STDCPP_COMPAT is defined. But I've concluded that such a thing should first be done in the runtime repo master (if it works at all).

@jeffschwMSFT jeffschwMSFT added this to the 2.1.x milestone Jun 4, 2020
@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Jun 4, 2020
@leecow leecow modified the milestones: 2.1.x, 2.1.20 Jun 4, 2020
@Anipik Anipik merged commit d640139 into dotnet:release/2.1 Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants